/*
 * Copyright(c) 2001-2008, FineReport Inc, All Rights Reserved.
 */
package report.utils;

import java.awt.*;

/**
 * GUI Utils
 */
public class GUIUtils {
	private GUIUtils() {}
	
    /**
     * Set window center on the screen.
     * @param win the current window
     */
    public static void centerWindow(Window win) {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension winSize = win.getSize();

        if (winSize.height > screenSize.height) {
            winSize.height = screenSize.height;
        }
        if (winSize.width > screenSize.width) {
            winSize.width = screenSize.width;
        }

        win.setLocation((screenSize.width - winSize.width) / 2,
                (screenSize.height - winSize.height) / 2 - 20);
    }
    
	public static void fullScreenWindow(Window win) {
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

		if (OSUtils.isWindows()) {
			win.setLocation(0, 0);
			win.setSize(screenSize.width, screenSize.height - 28);
		} else {
			win.setLocation(5, 23);
			win.setSize(screenSize.width, screenSize.height - 56);
		}
	}
}
